﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.LookAndFeel;

namespace td.Core
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.UserSkins.OfficeSkins.Register();
            DevExpress.UserSkins.BonusSkins.Register();

            //从配置文件中获取默认皮肤的名字
            var skin = System.Configuration.ConfigurationManager.AppSettings["Skin"];
            //载入默认的皮肤
            UserLookAndFeel.Default.SetSkinStyle(skin);
            //设置皮肤变化事件
            UserLookAndFeel.Default.StyleChanged += new EventHandler(Default_StyleChanged);
            
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            try
            {
                Application.Run(WorkBenchSingleTon.WorkBench);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }

        static void Default_StyleChanged(object sender, EventArgs e)
        {
            string skin = (sender.ToString().Split(':'))[1];
            
             
        }

        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            MessageBox.Show(e.ToString());
        }
    }
}